export default {
  methods: {
    checkLogin () {
      if (!this.$store.getters['user/token']) {
        this.$dialog.confirm({
          title: '温馨提示',
          message: '此时需要先登录才能继续操作哦~',
          confirmButtonText: '去登录',
          cancelButtonText: '再逛逛'
        })
          .then(() => {
            // on confirm
            console.log('是的我登陆去了')
            this.$router.replace({
              path: '/login',
              query: {
                backUrl: this.$route.fullPath
              }
            })
          })
          .catch(() => {
            console.log('取消了')
            // on cancel
          })
        return false
      } else {
        return true
      }
    }
  }
}
